import java.util.Objects;
import java.util.Random;
import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User:岁亮亮
 * Date:2023-12-30
 * TIME:11:27
 */
public class StringTest { //方法重载   一个词有多种含义

    public static int add(int a,int b){
        return a+b;
    }
    public static double add(double a,double b){
        return a+b;
    }
    public static int add(int a,int b,int c){
        return a+b+c;
    }
    public static void main(String[] args) {
        System.out.println(add(1, 2));
        System.out.println(add(1.0, 2.0));
        System.out.println(add(1, 2, 3));
    }
    public static int jie(int n){//阶乘  递归
        if(n==1){
            return 1;
        }
        else{
            return jie(n-1)*n;
        }
        /*int ret=1;
        for (int j = 1; j <= n; j++) {
            ret*=j;
        }
        return ret;*/

    }
    public static int fun(int n){//阶乘和  递归
        if(n==1){
            return 1;
        }
        else{
            int a = jie(n);
            return a+fun(n-1);
        }
        /*int sum=0;
        for (int j = 1; j <= n; j++) {
            sum+=jie(j);
        }
        return sum;
*/
    }
    public static int sum(int a,int b){//方法
        return a+b;
    }//
    public static void main1(String[] args) {//没有方法说明这种说法
        /*int a=sum(10,20);
        int b=20;
        int c=2;
        int v=sum(b+b,c+b);
        System.out.println(v);
        System.out.println(a);*/
        int n=fun(5);
        System.out.println(n);

    }
}



